import { Body, Controller, Get, Post, Query } from '@nestjs/common';
import { HelloService } from './hello.service';
import { BasicController } from 'src/basic/basic.controller';
import { ApiTags } from '@nestjs/swagger';
import HelloDto from './hello.dto';

class Person {
  public name: string;
  public hobby: string;

  toString() {
    return this.name + this.hobby;
  }
}

@ApiTags('Hello')
@Controller('hello')
export class HelloController extends BasicController<HelloDto> {
  constructor(private readonly helloService: HelloService) {
    super(helloService);
  }

  @Post('boot')
  helloBoot(@Body() params: Person): string {
    return 'Hello Spring Boot' + params.name + params.hobby;
  }

  @Get('getAll')
  async getAll() {
    return await this.helloService.getAll();
  }

  @Get('getById')
  async getById(@Query('id') id: number) {
    return await this.helloService.info(id);
  }
}
